<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<table>
			<tr>
				<td>张三</td>
				<td id="t1">20</td>
				<td>男</td>
			</tr>
		</table>
		<script type="text/javascript">
			//获取table节点对象
			var table = document.querySelector('table');
			//---------------------子---------------------------------------
			//获取table节点对象的直接后代节点对象(数组)
			var c1 = table.children;
			// console.log(c1);
			var c2 = c1[0].children;
			// console.log(c2);

			//---------------------父---------------------------------------
			var td = document.querySelector('#t1');
			var tdParent = td.parentElement;
			// console.log(tdParent);

			//---------------------兄弟---------------------------------------
			var td = document.querySelector('#t1');
			var preTd = td.previousElementSibling; //上一个兄弟
			console.log(preTd);
			var nextTd = td.nextElementSibling;
			console.log(nextTd); //下一个兄弟
		</script>
	</body>
</html>
